#define  _CRT_SECURE_NO_WARNINGS



#include<stdio.h>

int fun(int n)
{
	int x = 0, y = 0;
	while (n)
	{
		x = n % 10;
		y = y * 10 + x;
		n /= 10;
	}
	return y;
}
int fun2(int n)
{
	int sum = 0;
	while (n)
	{
		sum += n % 10;
		n /= 10;
	}
	return sum;
}
int main()
{
	int n = 0, i = 0;
	scanf("%d", &n);
	for (i = 10000; i <= 999999; i++)
	{
		if (fun(i) == i && fun2(i) == n)
			printf("%d\n", i);
	}

	return 0;
}